'use strict'
import { App } from '../../component'
import HomePage from './homePage'
import setTitle from '../../config/setTitle'
import { observer, inject } from 'mobx-react'

@inject('user') @observer class Set extends React.Component {
  static propTypes = {
    user: PropTypes.object,
    history: PropTypes.object
  }
  componentDidMount () {
    setTitle('个人主页')
    this.props.user.getHomeData()
  }
  _renderPage () {
    const { recordList } = this.props.user
    if (recordList) {
      return (<HomePage getNum={recordList.slice().length} history={this.props.history}/>)
    }
  }
  render () {
    return (
      <App noSysScroll={false}>
        { this._renderPage()}
      </App>
    )
  }
}

export default Set
